Add rector rule for EventManager::on() signature change in CakePHP 6.0#356
Add rector rule for EventManager::on() signature change in CakePHP 6.0#356
Conversation
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
|
@copilot Instead of checking whether the object is of type |
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
|
@copilot Fix the coding style errors reported by phpcs in https://github.com/cakephp/upgrade/actions/runs/19437153859/job/55610972954 |
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
Fixed coding style error (trailing whitespace) in commit 876b895 |
|
@copilot There are still coding style errors https://github.com/cakephp/upgrade/actions/runs/19437539152/job/55612498258?pr=356 |
1 similar comment
|
@copilot There are still coding style errors https://github.com/cakephp/upgrade/actions/runs/19437539152/job/55612498258?pr=356 |
|
@copilot resume based on last 2 comments |
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
|
@copilot no you dumbass, fix the errors reported in this checkstyle report |
Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com>
| $eventManager->on('Model.afterSave', $callable); | ||
|
|
||
| // Should NOT be transformed - 1 argument | ||
| $eventManager->on('Model.afterDelete'); |
There was a problem hiding this comment.
this is not a valid usecase but I can clean that up later
#356) * Initial plan * Add EventManagerOnRector for EventManager::on() signature change Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Refine EventManagerOnRector and update test fixture Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Revert accidental composer.json changes Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Change type check to EventManagerInterface instead of EventManager Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Fix coding style: remove trailing whitespace Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Fix coding style: remove blank line after function opening brace Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Fix docblock format: add blank line before last @see tag Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> * Fix CS errors --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ADmad <142658+ADmad@users.noreply.github.com> Co-authored-by: ADmad <admad.coder@gmail.com>
Summary
Successfully implemented the EventManager::on() signature change rector for CakePHP 6.0:
What was done:
EventManagerOnRectorthat swaps the 2nd and 3rd arguments whenEventManager::on()is called with 3 argumentsCake\Event\EventManagerInterfaceinstead of the concrete classTransformation:
The implementation follows the existing patterns in the codebase and handles all test cases correctly.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.